<?php
class Faqs_content_Model extends ORM
{
	protected $table_name = 'faqs_content';
	protected $primary_key = 'faqs_content_id'; 
	protected $col_faqs_id = 'faqs_id';
	protected $col_language_id = 'languages_id';
	protected $sorting = array('faqs_content_id' => 'desc');
	
	public function get($faqs_id='',$language_id='')
	{
		$this->db->select('*');
		$this->db->from($this->table_name);		
		$this->db->orderby($this->primary_key,'desc');
		if($faqs_id) $this->db->where($this->col_faqs_id,$faqs_id);
		if($language_id) $this->db->where($this->col_language_id,$language_id);
		$query = $this->db->get();
		$arr = $query->result_array(false);
		return $arr;
	}

	public function get_faqs($lang)
	{
		$this->db->select('*');
		$this->db->from('faqs');
		$this->db->join('faqs_content','faqs.faqs_id','faqs_content.faqs_id');
		$this->db->where('faqs_status',1);
		if($lang)
		$this->db->where('languages_id',$lang);
		$this->db->orderby('faqs_sort_order','desc');	
		$this->db->orderby($this->primary_key,'desc');
		//echo $this->db->last_query();
		$query = $this->db->get();
		return $query->result_array(false);
	}
}